package com.knife.service;

import java.util.*;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServlet;
import javax.servlet.*;

import javax.servlet.http.HttpServlet;


public class FlowNodeTask extends TimerTask {

	private static final int C_SCHEDULE_HOUR=0;
	private static boolean isRunning = false;
	private ServletContext context = null ;
	
	public FlowNodeTask() {
		// TODO Auto-generated constructor stub
		
	}

	public FlowNodeTask(ServletContext context){
		this.context=context;
	}
	@Override
	public void run() {
		// TODO Auto-generated method stub
		//run()方法编写任务内容
		Calendar cal = Calendar.getInstance();
		if(!isRunning){
			if(C_SCHEDULE_HOUR==cal.get(Calendar.HOUR_OF_DAY)){
				isRunning = true;
				context.log("开始执行指定任务");
				
				//TODO 添加自定义的详细任务，
				
				
				
				isRunning = false;
				context.log("指定任务执行结束");
			}
		}else{
			context.log("上一次任务执行还未结束");
		}
	}

}
